package com.exl.zkclient.mapper;

import com.exl.zkclient.entity.Product;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

@Mapper
public interface ProductMapper {

  @Select("select * from product where id =#{id}")
  Product getProduct(@Param("id") int id);

  @Update("update product set stock = stock -1 where id=#{id}")
  int deductStock(@Param("id") int id);
}
